package com.neusoft.elmboot.po.wallet;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 钱包规则配置实体类
 * 用于配置充值和提现的奖励规则
 */
@Data
@NoArgsConstructor
@TableName(value = "wallet_rule")
public class WalletRule implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 规则类型：recharge-充值规则，withdraw-提现规则
     */
    @TableId
    private String ruleType;

    /**
     * 充值满额门槛（单位：元）
     */
    private BigDecimal rechargeLevel;

    /**
     * 充值奖励金额（单位：元）
     */
    private BigDecimal rechargeGift;

    /**
     * 提现手续费率（0-1之间的小数，如0.1表示10%）
     */
    private BigDecimal withdrawRate;

    /**
     * 每日利率（用于透支利息计算，0-1之间的小数，如0.001表示0.1%）
     */
    private BigDecimal dailyInterestRate;

    /**
     * 最低透支额度
     */
    private BigDecimal minOverdraftAmount;

    /**
     * 最高透支额度
     */
    private BigDecimal maxOverdraftAmount;

    private LocalDateTime createTime;

    private LocalDateTime updateTime;

    public WalletRule(String ruleType, BigDecimal rechargeLevel, BigDecimal rechargeGift, 
                     BigDecimal withdrawRate, BigDecimal dailyInterestRate,
                     BigDecimal minOverdraftAmount, BigDecimal maxOverdraftAmount) {
        this.ruleType = ruleType;
        this.rechargeLevel = rechargeLevel;
        this.rechargeGift = rechargeGift;
        this.withdrawRate = withdrawRate;
        this.dailyInterestRate = dailyInterestRate;
        this.minOverdraftAmount = minOverdraftAmount;
        this.maxOverdraftAmount = maxOverdraftAmount;
        this.createTime = LocalDateTime.now();
        this.updateTime = LocalDateTime.now();
    }
}

